import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

// import { defineConfig } from 'vite';
import { readFileSync } from 'fs';
import { join } from 'path';

// 读取 package-info.json 文件
const packageInfoPath = join(process.cwd(), 'package-info.json');
const packageInfo = JSON.parse(readFileSync(packageInfoPath, 'utf-8'));
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: true, // 监听所有网卡
    port: 5173, // 指定端口号
  },
  define: {
    'import.meta.env.PACKAGE_INFO': JSON.stringify(packageInfo),
  },
});
